package com.library.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 角色类型枚举类
 *
 * @author: xyh
 * @create: 2023-08-02
 **/
@Getter
@AllArgsConstructor
public enum RoleTypeEnum {

    SUPER_ADMIN(1, "超级管理员"),
    LIBRARY_ADMIN(2, "图书管理员"),
    ORDINARY(3, "普通用户");


    private Integer code;
    private String desc;

    public static String getValue(Integer code) {
        RoleTypeEnum[] roleTypeEnums = values();
        for (RoleTypeEnum roleTypeEnum : roleTypeEnums) {
            if (roleTypeEnum.getCode().equals(code)) {
                return roleTypeEnum.getDesc();
            }
        }
        return null;
    }

}
